﻿<?xml version="1.0" encoding="utf-8" ?>
<Feature id="FileSys" name="File System Feature Configuration">
	<BusinessRules>
		<BusinessRule name="getFileSysCaches" security="disabled">
			<Option value="$FileSysRemoteTier$">
				<RemoteRule url="$FileSysRemoteTier$" />
				<LocalClass name="Syrinx.FileSysBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getFileSysCacheAppFunctions" security="disabled">
			<Option value="$FileSysRemoteTier$">
				<RemoteRule url="$FileSysRemoteTier$" />
				<LocalClass name="Syrinx.FileSysBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="updateFileSysCache" security="disabled">
			<Option value="$FileSysRemoteTier$">
				<RemoteRule url="$FileSysRemoteTier$" />
				<LocalClass name="Syrinx.FileSysBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="deleteFileSysCache" security="disabled">
			<Option value="$FileSysRemoteTier$">
				<RemoteRule url="$FileSysRemoteTier$" />
				<LocalClass name="Syrinx.FileSysBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getFileSysDirectories" security="disabled">
			<Option value="$FileSysRemoteTier$">
				<RemoteRule url="$FileSysRemoteTier$" />
				<LocalClass name="Syrinx.FileSysBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getFileSysDirectoryDetails" security="disabled">
			<Option value="$FileSysRemoteTier$">
				<RemoteRule url="$FileSysRemoteTier$" />
				<LocalClass name="Syrinx.FileSysBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="updateFileSysDirectory" security="disabled">
			<Option value="$FileSysRemoteTier$">
				<RemoteRule url="$FileSysRemoteTier$" />
				<LocalClass name="Syrinx.FileSysBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="deleteFileSysDirectory" security="disabled">
			<Option value="$FileSysRemoteTier$">
				<RemoteRule url="$FileSysRemoteTier$" />
				<LocalClass name="Syrinx.FileSysBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getFileSysFiles" security="disabled">
			<Option value="$FileSysRemoteTier$">
				<RemoteRule url="$FileSysRemoteTier$" />
				<LocalClass name="Syrinx.FileSysBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getFileSysFileDetails" security="disabled">
			<Option value="$FileSysRemoteTier$">
				<RemoteRule url="$FileSysRemoteTier$" />
				<LocalClass name="Syrinx.FileSysBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="updateFileSysFile" security="disabled">
			<Option value="$FileSysRemoteTier$">
				<RemoteRule url="$FileSysRemoteTier$" />
				<LocalClass name="Syrinx.FileSysBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="moveFilesToDirectory" security="disabled">
			<Option value="$FileSysRemoteTier$">
				<RemoteRule url="$FileSysRemoteTier$" />
				<LocalClass name="Syrinx.FileSysBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="deleteFileSysFiles" security="disabled">
			<Option value="$FileSysRemoteTier$">
				<RemoteRule url="$FileSysRemoteTier$" />
				<LocalClass name="Syrinx.FileSysBizRules,ScsCore" />
			</Option>
		</BusinessRule>
	</BusinessRules>

	<BusinessObjects>
		<BusinessObject type="FileSysQueryInfo" key="id">
			<Field name="id" type="String" />
			<Field name="companyId" type="Guid" />
			<Field name="cacheName" type="String" />
			<Field name="baseDirectory" type="String" />
			<Field name="name" type="String" />
			<Field name="fileFilters" type="String" />
			<Field name="includeBinary" type="Boolean" />
		</BusinessObject>

		<BusinessObject type="FileSysCache" key="id">
			<Field name="id" type="Guid" />
			<Field name="companyId" type="Guid" />
			<Field name="name" type="String" />
			<Field name="baseLocation" type="String" />
		</BusinessObject>

		<BusinessObject type="FileSysDirectory" key="keyName" >
			<Field name="keyName" type="String" />
			<Field name="name" type="String" />
			<Field name="parentName" type="String" />
			<Field name="depth" type="Integer" />
			<Method name="depthName" language="jscript.NET">
				<![CDATA[
				var depth : Int32 = self.getItem("depth");
				var str = "";
				for(var p = 0; p < depth; p++)
					  str+="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
				return (str.replace(/\&/g,"#&#") + self.getItem("name")).ToString();
			]]>
			</Method>

			<Field name="cacheName" type="String" />
			<Field name="fileCount" type="Integer" />
		</BusinessObject>

		<BusinessObject type="FileSysFile" key="id">
			<Field name="id" type="String" />
			<Field name="name" type="String" />
			<Field name="parentName" type="String" />
			<Field name="cacheName" type="String" />
			<Field name="fileImageUrl" type="String" />
			<Field name="fileUrl" type="String" />
			<Field name="dateCreated" type="Date">
				<NULL/>
			</Field>
			<Field name="size" type="BigInteger" />
			<Field name="data" type="Binary">
				<NULL/>
			</Field>

			<Method name="displaySize" language="jscript.NET">
				<![CDATA[
				var s = self.getItem("size");
				if(s >= 1073741824)
					return (s/1073741824).toFixed(1) + " Gb";
				else if (s >= 1048576)
					return (s/1048576).toFixed(1) + " Mb";
				else if(s >= 1024)
					return (s/1024).toFixed(1) + " Kb";
				return s;
			]]>
			</Method>
			

			<Method name="gridName" language="jscript.NET">
				<![CDATA[
				return String.Format("{0} #&lt;#a href='{1}' #&gt;#(download)#&lt;#/a#&gt;#",
					self.getItem("name"), self.getItem("fileUrl"));
			]]>
			</Method>
			<Method name="gridImage" language="jscript.NET">
				<![CDATA[
				if(Cmn.IsEmpty(self.getItem("fileImageUrl")))
					return "";
				return self.getItem("fileImageUrl").Replace("FsSize", "FsSmallSize");
			]]>
			</Method>
		</BusinessObject>

		<BusinessObject type="FileSysCacheAppFunction" extends="DynamicAppFunction" key="id">
			<Field name="isFileSysCache" type="Boolean">True</Field>
		</BusinessObject>
	</BusinessObjects>

	<ApplicationFunctions id="FileSystem" description="Company File System">
		<AppFunction id="ManageFileSystem" description="Manage the general company file system." />
		<DynamicAppFunction id="FileSysCacheAppFunctions" bizrule="getFileSysCacheAppFunctions" bizobjType="FileSysCacheAppFunction" scope="companyId" />
	</ApplicationFunctions>

	<ClassFactory id="BizProcs">
		<Class type="Syrinx.Gui.FileSysCacheBizProc,ScsCore" name="fileSysCache"/>
		<Class type="Syrinx.Gui.FileSysDirectoryBizProc,ScsCore" name="fileSysDirectory"/>
		<Class type="Syrinx.Gui.FileSysFileBizProc,ScsCore" name="fileSysFile"/>
		<Class type="Syrinx.Gui.FileSysUploadBizProc,ScsCore" name="fileSysUpload"/>
	</ClassFactory>

</Feature>